package Dxc;

public class MyRunnable implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("Run代码运行");
        }
    }

    public static void main(String[] args) {
        MyRunnable myRunnable = new MyRunnable();
        //创建线程对象，通过线程对象来开启我们的线程，代理。
        Thread thread = new Thread(myRunnable);//不同的一步
        thread.start();
        //以上两行代码可以简写: new Thread(MyRunnable).start();
        for (int i = 0; i < 100; i++) {
            System.out.println("Main代码运行");
        }
    }
}
